<template>
	<div>
		<div v-if="user.isLogin">
			<h2>当前用户： {{ user.username }}</h2>
			<van-button type="danger" @click="store.commit('quit')">退出登录</van-button>
		</div>
		<div v-else>
			<van-button type="primary" block @click="$router.push('/login')">未登录/去登录</van-button>
		</div>


		<van-cell title="浏览记录" is-link @click="$router.push('/user/history')"/>
		<van-cell title="我的信息" is-link />
		<van-cell title="设置" is-link />
	</div>
</template>

<script lang="ts" setup>

import { State } from '@/store'
import { computed } from 'vue'
import { useStore } from 'vuex'
const store = useStore<State>()
const user = computed(() => store.state.user)

</script>